﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TestCase.Master" AutoEventWireup="true"
    CodeBehind="UploaderTests.aspx.cs" Inherits="OpenWaves.Web.Tests.UploaderTests" %>
<%@ Register TagPrefix="my" TagName="FileList" Src="~/FileList.ascx" %>

<asp:Content ContentPlaceHolderID="TestCasePlaceHolder" runat="server">
    <asp:ScriptManager runat="server"></asp:ScriptManager>
    
    <h2>Simplest usage</h2>
    <ow:Upload ID="Uploader0" runat="server" />
    <asp:Button runat="server" Text="Save" OnClick="SimpleSave" />
    <my:FileList ID="fileList0" runat="server" Files="<%# this.Uploader0.Files %>"/>

    <h2>Regular postback (with filelist &nbsp; progress bar shown)</h2>
    <ow:Upload ID="Uploader1" runat="server" QueueId="queue" IncludeJQuery="false" Runtimes="Silverlight">
        <SelectorTemplate>
            <a href="javascript:void(0);" runat="server">Browse</a>
        </SelectorTemplate>
    </ow:Upload>
          
    <div id="queue">
    </div>
    <asp:Button runat="server" Text="Save" OnClick="SaveFiles1" ID="lnkSave" />
    <my:FileList ID="fileList1" runat="server" Files="<%# this.Uploader1.Files %>"/>

    <asp:UpdatePanel runat="server">
        <ContentTemplate>
            
            <!-- initialization needed when used inside update panel -->
            <script type="text/javascript">
                var prm = Sys.WebForms.PageRequestManager.getInstance();

                prm.add_endRequest(function () {
                    <%= this.Uploader2.InitializationScript %>
                });
            </script>
            
            <h2>Async (update panel, with no progress bar, and required field validator)</h2>
            
            <ow:Upload ID="Uploader2" runat="server" IncludeJQuery="false" ValidationGroup="FileReq" />
            <asp:RequiredFieldValidator runat="server" ControlToValidate="Uploader2" ErrorMessage="please select a file!" ValidationGroup="FileReq" Display="Dynamic"></asp:RequiredFieldValidator>    
            <asp:Button runat="server" Text="Save" OnClick="SaveFiles2" ValidationGroup="FileReq" />
            <my:FileList ID="fileList2" runat="server" Files="<%# this.Uploader2.Files %>"/>
        </ContentTemplate>
    </asp:UpdatePanel>
            
    <h2>AutoPostBack</h2>
    <h3>Every XHTML element can trigger the upload</h3>
    <ow:Upload ID="Uploader3" runat="server" IncludeJQuery="false" AutoPostBack="true" OnFilesChanged="Upload3FilesUploaded">
        <SelectorTemplate>
            <img src="TheBossIcon.png" alt="select file..." style="cursor: pointer" title="select file..." />
        </SelectorTemplate>
    </ow:Upload>
    <my:FileList ID="fileList3" runat="server" Files="<%# this.Uploader3.Files %>"/>

</asp:Content>
